package com.gitee.swsk33.multidatademo.api;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.gitee.swsk33.multidatademo.dao.CommentDAO;
import com.gitee.swsk33.multidatademo.dataobject.Comment;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/comment")
public class CommentAPI {

	@Autowired
	private CommentDAO commentDAO;

	// DS指定数据源
	@DS("slave-1")
	@GetMapping("/get/{id}")
	public Comment getById(@PathVariable int id) {
		return commentDAO.selectById(id);
	}

}